"use strict";
cc._RF.push(module, '15db2rSpgFDKbY+a/gq5msR', 'ChangeColorPolicy');
// Script/2.Home/ChangeColorPolicy.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RingPolicy = exports.ColorPolicy = void 0;
const Model_ShadowType_1 = require("./Model.ShadowType");
class ColorPolicy {
    static getColorType() {
        var random = Math.floor(1 + (Math.random()) * 6);
        if (random == 1)
            return Model_ShadowType_1.ColorType.yellow;
        if (random == 2)
            return Model_ShadowType_1.ColorType.red;
        if (random == 3)
            return Model_ShadowType_1.ColorType.blue;
        if (random == 4)
            return Model_ShadowType_1.ColorType.dyellow;
        if (random == 5)
            return Model_ShadowType_1.ColorType.violet;
        if (random == 6)
            return Model_ShadowType_1.ColorType.green;
    }
}
exports.ColorPolicy = ColorPolicy;
class RingPolicy {
    static setDeafult() {
        this.colorList = this.defaultColorList;
    }
    static getAngle(colorType) {
        let index = RingPolicy.colorList.indexOf(colorType);
        //Logger.info("更改前"+RingPolicy.colorList)
        let angle = RingPolicy.getAngleByIndex(index);
        //重新放置
        let isContinue = true;
        while (isContinue) {
            let type = RingPolicy.colorList.shift();
            if (type == colorType) {
                isContinue = false;
                RingPolicy.colorList.unshift(type);
            }
            else {
                RingPolicy.colorList.push(type);
            }
        }
        // Logger.info("更改后"+RingPolicy.colorList)
        // Logger.info(angle);
        return angle;
    }
    static getAngleByIndex(index) {
        if (index == 0)
            return 0;
        if (index == 1)
            return 60;
        if (index == 2)
            return 120;
        if (index == 3)
            return -180;
        if (index == 4)
            return -120;
        if (index == 5)
            return -60;
    }
    /*根据颜色得到淡出
    的坐标位置*/
    static getPositionByColorType(colorType) {
        let index = RingPolicy.defaultColorList.indexOf(colorType);
        //普通坐标系下
        let angle = 0;
        if (index == 0)
            angle = -90;
        if (index == 1)
            angle = -150;
        if (index == 2)
            angle = 150;
        if (index == 3)
            angle = 90;
        if (index == 4)
            angle = 30;
        if (index == 5)
            angle = -30;
        let y = Math.sin(angle * Math.PI / 180);
        let x = Math.cos(angle * Math.PI / 180);
        return cc.v2(x, y);
    }
}
exports.RingPolicy = RingPolicy;
RingPolicy.defaultColorList = [
    Model_ShadowType_1.ColorType.violet,
    Model_ShadowType_1.ColorType.dyellow,
    Model_ShadowType_1.ColorType.blue,
    Model_ShadowType_1.ColorType.red,
    Model_ShadowType_1.ColorType.yellow,
    Model_ShadowType_1.ColorType.green,
];
RingPolicy.colorList = [
    Model_ShadowType_1.ColorType.violet,
    Model_ShadowType_1.ColorType.dyellow,
    Model_ShadowType_1.ColorType.blue,
    Model_ShadowType_1.ColorType.red,
    Model_ShadowType_1.ColorType.yellow,
    Model_ShadowType_1.ColorType.green,
];

cc._RF.pop();